#include<iostream>
#include<cstring>
using namespace std;
const int N = 110, M = 1e4 + 10;
bool f[N][M];
string ans;
int a[N];
int b[N];
int n, m;

void dfs(int x, int y)
{
	if (!x)return;
	if (y >= a[x] && f[x - 1][y - a[x]]) {
		dfs(x - 1, y - a[x]);
		ans += "H";
	}
	else if (y >= b[x] && f[x - 1][y - b[x]]) {
		dfs(x - 1, y - b[x]);
		ans += "T";
	}
}
int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> a[i] >> b[i];
	}
	f[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= m; j++) {
			f[i][j + a[i]] |= f[i - 1][j];
			f[i][j + b[i]] |= f[i - 1][j];
		}
	}
	if (f[n][m]) {
		cout << "Yes" << endl;
		dfs(n, m);
		cout << ans << endl;
	}
	else cout << "No" << endl;
	return 0;
}